import java.io.*;
import java.util.*;
import java.lang.*;

public class People implements java.io.Serializable,Runnable
{
	private String name;
	private long ID;
	private static long nextID = 0;
	private transient int hash;

	public People() {
		name = "Hello";
		synchronized(People.class) {
			ID = nextID++;
		}

		hash=name.hashCode();
	}
	public People(String name) {
		this.name = name;
		synchronized(People.class) {
			ID = nextID++;
		}

		hash=name.hashCode();
	}

	public String toString() {
		return name;
	}

	public void run() {
		print();
	}

	public int hashCode () {
		return hash;
	}

	public void print() {
		System.out.println(name);
	}

	private void writeObject(ObjectOutputStream out) 
		throws IOException
	{
		out.writeUTF(name);
		out.writeLong(ID);
	}

	private void readObject(ObjectInputStream in)
		throws IOException, ClassNotFoundException
	{
		name = in.readUTF();
		ID = in.readLong();
		hash = name.hashCode();
	}

	public static void main(String[] args) {
		People p = new People("Junix");
		try{
			FileOutputStream fileOut = new FileOutputStream("junix");
			ObjectOutputStream out = new ObjectOutputStream(fileOut);
			out.writeObject(p);
		} catch (IOException ex) {} 
		finally{ }

		People p2 = null;
		try{
			FileInputStream fileIn = new FileInputStream("junix");
			ObjectInputStream in = new ObjectInputStream(fileIn);
			p2 = in.readObject();
		} catch (IOException ex) {} 
		 catch (ClassNotFoundException fe) {} 
		finally{ }

		p2.print();
	}
}
